changed select function as prof said 2