working price function but still needs error handling