Refactor interfaces to make application context configurable