Added double. Refactored c++