added emergency brake into while loop - just for don't breaking the whole application, if something goes wrong :)