Code cleanup and created constants for conversion factors.