Cleaned up MySQL module and added tests