Added documenation and general reorganization