modified for usage with mysql