code clean-up, tightened up param filtering