cleaned up code; removed velocity; added comments