Move some classes around and add a few methods to the Web API class.
Fix NPE