wrapped x restriction loop in conditional to prevent error when x restriction is empty
added some pending tests