Added more documentation, fixed some formatting