updated to use stored procs