added code to views and optimized it.
ignore