added p43. ugle code, but excellent logic