cleaned a little of the code up