Introduce get CONFIG/STATE functions. Make use of promises. Update tests.