Cleanup of the code to get the Device Code