minor performance improvements and documentation