Refactored the slot imlementation code 

lets a use a (volatile) boolean flag to check weather we need to keep running