improved code climate by removing traverse