Form handler now uses database to check device code
Changed all references of deviceId to deviceCode