More-or-less working version, still needs add files/etc.