refactors total resources to be less superstupid