Improvements and Code cleanup