Reducing size of main conversion function by creating sub functions.