Use numpy float64 instead of python float
Refactorings and optimizations