added waitkey and renamed some stuff