sorts posts in the right order
added initial cleanups