Fixed bot
Added logging function
removed some duplicate code
Merge pull request #1 from pworek/master

Fixed bot