refactoring and fixed strict errors