improve output and add functions for calculations