another major rewrite, this looks a lot better
add missing files