split out compatibility code to its own file