Removed unused code and modified a few things to match closer