You're only changing position when velocity.length() is zero, so the change in position is always zero.. Did you intend to place those three position statements after the "if", rather than after the "else"?
In other words, remove the extra tabs in lines 23-25.