Resources are properly visible in embedded pages; fixes #154

- limit code execution to embedded or normal content pages
- this and that (self) cleanup
- more code documentation
- removed accidental global variables
- close() method now uses the ISNLogger