Moved some code to an internals file, updated Cost API spec