Created loop for cmd check