Makes this actually work properly. It's always harder than it looks.