simple optimizer implemented