Implemented optimization