Reduce complexity in update post function