added loop for continuous working