fixed end case, added acceleration