refactored so that /post/edit can take an optional param id