Properly Fixed Compatibility Mode bug

Finally fixed #21  by breaking out some of the logic into its own
function.