Added documentation, fixed formatting