added expandWhere function