first attempt of optimization, code: OPT1