Cleaned up code and finished testing based on major behaviours

Finished segregation and tests for major behaviours have been
implemented. Can be considered as major change version.