some improvements; using string formatting