changed indexing for decision function