Added the logic, made some tweaks
Merge pull request #3 from GunnJerkens/master

Added the logic, made some tweaks