done except for making the code nice