Separated views into views and helper functions files. Bug fixes.