removed lots of old mysql calls + cleanup