diff --git a/lib/ruby/stdlib/monitor.rb b/lib/ruby/stdlib/monitor.rb
index 26b976b860a..f1a44a4f9e1 100644
--- a/lib/ruby/stdlib/monitor.rb
+++ b/lib/ruby/stdlib/monitor.rb
@@ -7,17 +7,24 @@
# You can freely distribute/modify this library.
#
+case RUBY_ENGINE
+when 'jruby'
+ JRuby::Util.load_ext("org.jruby.ext.monitor.MonitorLibrary")
+else
+ require 'monitor.so'
+end
+
#
# In concurrent programming, a monitor is an object or module intended to be
-# used safely by more than one thread. The defining characteristic of a
-# monitor is that its methods are executed with mutual exclusion. That is, at
+# used safely by more than one thread. The defining characteristic of a
+# monitor is that its methods are executed with mutual exclusion. That is, at
# each point in time, at most one thread may be executing any of its methods.
# This mutual exclusion greatly simplifies reasoning about the implementation
# of monitors compared to reasoning about parallel code that updates a data
# structure.
#
# You can read more about the general principles on the Wikipedia page for
-# Monitors[https://en.wikipedia.org/wiki/Monitor_%28synchronization%29]
+# Monitors[https://en.wikipedia.org/wiki/Monitor_%28synchronization%29].
#
# == Examples
#
@@ -48,7 +55,7 @@
# end
#
# The consumer thread waits for the producer thread to push a line to buf
-# while buf.empty?. The producer thread (main thread) reads a
+# while buf.empty?. The producer thread (main thread) reads a
# line from ARGF and pushes it into buf then calls empty_cond.signal
# to notify the consumer thread of new data.
#
@@ -86,14 +93,6 @@
# This Class is implemented as subclass of Array which includes the
# MonitorMixin module.
#
-
-case RUBY_ENGINE
-when 'jruby'
- JRuby::Util.load_ext("org.jruby.ext.monitor.MonitorLibrary")
-else
- require 'monitor.so'
-end
-
module MonitorMixin
#
# FIXME: This isn't documented in Nutshell.