Removed while loop from on off function.