adding AFK functionality, fixes #6. Fixing a few other bugs.