Better implementation of the beeping using timer functionality