code cleanup for profile controller and test cases fixed