Required logic is implemented. (Some refactoring is needed in views).