First draft of post types + minor speed improvement