enhancements and code cleanup