cleaned up code. exactly same output as before.