handle exceptions in helpers, simplify web and api
add some more comments