Changed implementation of calculator with double