router added, gave functions names instead of anonymous for easier debugging