refactor code
add 404 500 page