refactoring, remove some non-DRY code
link contributors