Interpretation of carrier frequency found online didn't quite work. My original implementation was apparently better