move calculation of movement back into unit
fix sorting
indenting