Switched to async processing. Saves a lot of code. Also switched to a tree-like structure for PID saving.