Cleaned code a bit