Added spec change + fixed logic error