cleaned code a little