cleaned code up