fixed function setting code
cleaning up