commented version with numpy bugs