changed method to return 2 values instead of one