Some Profile Refactoring.

Fixed some sortable bugs and made the directive more modular and removed
the fields dependency.