code cleanup and bug fixes
code clean-up
send chat message
Merge pull request #40 from tomamic/master

minor fixes