Removed a lot of code thanks to some neat MySQL commands