Removed unused code and added in some documentation