refactor the post manager and add template manager