refactored code and merged components into a views