Fixed bug and removed repetetive code
Merge pull request #9 from anryko/master

Fixed bug and removed repetetive code