Finished first pass backend refactor