This is currently a mess, but at least it's a start