introduced time measurement routines into the code and got rid of alphabet parameter