Add post handling and factor out common types