Refactored and solved an init bug
Additional refactoring