Change to const and pass by reference.
modified int getObservations function to return proper values upon failure.