added firstpart function, revised comments -KL