Tidied up lib structure a bit