Refactoring controller stuffs to JAF.