fixing my terrible code