Updated documentation. Code cleanup