fixed problem where we could get negative prices. moved pricing code into its own file.