better handling of routes. Should fix #16