improved comments and tests