calc code implemented