Refactoring and documentation

Added proper documentation for all classes and functions. Please keep
this up as the game engine grows.