add conn to function arguments
cleaned up associations code