Refactored beacon functionality to beacon object.