Documentation updated and code cleanup