cleaned code up a bit