Added new classes and made some code-reenginering