removed some debugging statements, added function prototype