refactored devices and began adding some code to load old beacons from the database