major code clean-up, more optimal mysql code