261214 Refactoring and fixes

-Needs some todos
-And testing