Implemented the following things:

localStorage for alarms
assigned selector to variable
moved setInterval to avoid race condition
organized javascript code