changed QApplication to QCoreApplication, to remove gui depepdancies.