Split code out to make management easier