Finalized conversion to MySQL