Updated SQL to account for changing information