Enhance Quality and clean some code