cast post_id as int, check before proceeding. additional inline comments