refactaring bonanza source code