removed C++ style comments, added error control for invalid alphabet size