Cleaned up the code A LOT