Moved from unsafePerformIO to monads; more user-friendly output