if this were haskell i wouldn't have to do this