final version by sdq