Refactor, tests added to.
Transfer functionality added.