make REPL injectable and overrideable like other services
refactor:
 - redundant code
 - line length
 - guard clauses
 - EOL at end of file
 - readonly fields
 - replace if with null coalesce
 - replace if with inline conditional
 - whitespace