Fixed bug and reduced code
Merge pull request #168 from w35l3y/master

Fixed bug and reduced code