Improved structure

Cleaned the structure of the code and corrected some small issues with
class names.