Refactor baseUrl handling, move to ajax()