fixed some bugs and separated views into an api and web packages