moved controller function from router state object