Extract and improve makePrice function.