Add debug logs, switch from locks to queue, and general cleanup