added filtering and changed the value fn to use abs instead of shifted