Restructuring logic and removing duplicated code
Merge pull request #10 from nmadhok/restructure-logic

Restructuring logic and removing duplicated code