Notes added; debug/tests slightly changed