Refactored the code to make us of errors.

Still need to implement the finding of max_id and since_id.
Tried moving bot folder to root.