added some double arithmetic