Simplified alot of code to implement from my coremod