Updated some code and added documentation