Need to alter some code to reflect the usage of the ST monad