Added MySQL and used factories to improve codes