started documentation, cleaned code