More legacy code I copied over from the old project.