Started abstracting functionality, so it can be reused on other views.