some code cleanup/optimization.