Added views and fixed some bugs