Refactoring the UI controllers. Introduced networkmessage and pagination directive to reduce code dup.