more tests for better coverage; some comments added/reorganized