some testing and bugfixing of sort_posts\nsome parts need redesign