cleaned up view and trying to fix ajax logics