basic code refactoring