simplifying type system. changed signature to be more haskell-like. changing tuple types and system to better statically typed.