refactored blog controller