Added some comments and switches
Added comments and changed file structure