re-factor view in order to facilitate unit testing