added an alternative to using the controller and view functions (which are supposed to behave as class constructors.
moved controller and view to a separate module.