added generator, minor cleanup