Fixed bugs, cleaned up code and added some documentation