Made the calc surplus functions and cleaned up a bit