converted to python 3
Added code for basic alarm thread