Finished merge.
Started multi-threading code in Device.