Fleshed out the first version (no tests yet)