move post handle codes to the outer page