cleaned up beacon func