This part and the one starting at line 88 look suspiciously familiar - I belive it should be abstracted to a method to avoid repetition.