Merge pull request #312 from angathorion/refactor
Refactoring and small fix

(main@7116b9d5ca72f86590ca59e931b774b5d17eee77)