cleanup, helper methods, and documentation