Cleaning functions, and preparing for future enhancements