Adjusted to work with mysql