changed argument names and added checks in in sparseS