listening for variable changes in javascript https://stackoverflow.com/questions/1759987/listening-for-variable-changes-in-javascript