merged pull request #2 and made code neater