Cleaned code up a bit