some refactoring: move handlers into a separate packagge
may not work