Cleaning up
Split code for future multi-level support