Moved tests, added conditional values to select statements