Clean up code.
Extract beacon_plugin