moved some logic to post.js