Minor code cleanups, added some inline documentation, added loaded modules to environment display

Signed-off-by: Sebastian Klaus <sebastianklaus@icloud.com>