Refactored logic into view

closes #10