Adapted commit ea05919769 from klrkdekira/sinar-beacon