a little cleanup and fine tuning