Added code and tests