refactoring a bit to move codecs around to the api package