implemented generic views system and refactored code