Fixed some bugs in main program. Plugin is now loadable in QGIS!