Add all code from original QGCS