Breaked code into multiple files and classes; added comments