Some refactor style working, fixing an issue with wrong referred initialization.