ST monad implementation
note problems
simpler input
record all the properties