Important improvements and clean up