Did some cleanup and simplification