Inversed the priority system and added backward ini compatibility
also fixed not having fclose() on the last commit