Cleaned up setvs -- IMO control flow is easier to follow now
Also changed some conditions