Refactored code and fixed bin dir path issue.