Separated cube data collection from SQL generation. Added index generation.