Add support for #post (and minor refactoring)