Fixed calculator logic, and added methods to context and rate