refactor with example post type