Refactored numpy dependency handling.