Revert "Random changes"

This patch breaks the driver. The different chunks of the patch will
need to be tested separately.

This reverts commit 030ea7b269e07e5b4096dcedd239e17ce14c4c1b.