Cleaned Up the code a bit