Cleaning up code in post detial views