Add comments and remove duplicate code.
Merge remote-tracking branch 'remotes/origin/master' into repl