Reworked some logic to make it work for local-only use cases