added calc functionality (not perfect, buggy, etc. - you have been warned)