some optimizations
more work on the controls