Used scipy code copied to remove dependency