adding in a few more sql queries and stuff