Moved functions into function library, added new functionality to allow for running commands as well as chatting.