An improved version of the first converter, because I'm too lazy to refactor and redesign it.