some minor changes to increase performance