Changed selection variables to use numeric codes for table queries