refactoring and completing defines