code refactor / bug fixing
Merge pull request #1 from Lukz07/master

code refactor / bug fixing #2