Cleaned up code, added view templates