Added SQL file and several bugfixes and Python3 comaptibility