Added entity movement functions.

Also general tidying of code.