Now working well except for initial sample