cleaned up main querys and programmed log out link