improving perfomance and readability for post-template