implemented form builder and refactored PostsController methods