Adds working code and tests