updated the url-pattern to / and re-factored the code