optimize code at basic level