cleaned up routing mechanism