Separated the logic from the interface
Added comments 
Changed the names