attempting to optimize code