Complete re-implementation of java-calc