Move internal handlers into separate files