cleaned code (a little bit D:)