Move some functions around.
Use 'close' event instead of 'after' router