code cleaned and commented, ready for next step