Split up shared code between backends into separate file