Edit profile integration tests

Added edit_profile integration tests, cleaned up AJAX for edit view and made some other cosmetic edits and refactorings.

(ATTN: please examine each add)