cleaned code. added route handler