use before_filter to simplify new and edit code