Implemented a part of treasuregenerator.