clean up and fix get params function