Using liftIO, Applicative and additional minor changes...