Fix build on master + refactors