Added documentation, cleaned formatting