Changed the code so that it is a continually listening service. Lots of JS added