better implementation of move-line