Fixed SortByDistance and Organized Code

Added code regions on the HomeProfile page for readability and
maintainability