Add cube supported, a lot of change to main.cpp