refactoring done.  moved movement offset calculation to float