Added previous action variable (and class) to the Entity class

- also refactored and added entity tests