Cleaned stuff up and made it more efficient