Remove duplicate code and fix indentation
Merge pull request #6 from innoying/patch-1

Remove duplicate code and fix indentation