Adding feature to run only when phone is locked or the app is opened. Some minor fixes too.