better documentation and removed obsolete code