Updated package structure, added tests, tidied things