Refactored mysql.py and RAR module