added different behaviour depending on existence of posts