refactored code to show list of contacts view to controller