cleaning code up a but