Create & extend Entity class for object physics.

Also do a little refactoring.