added constants, added debug msgs