code refactoring and avoid messing on reload