Finished doc and cleaned code