added some before filters and dry-ed up the code a lil

dried it up a lil