More cleanup and router implementation