Move heavy lifting into kernel where appropriate