Refactoring! Moved to a class based view and other improvements for testing