Refactor: move repositories to core and extensions
Small bugfixes and refactor