cleaned upp the code