Updated documentation and cleanup code