Added measuring of time and started using canf/printf for formatting