Elisiano patch 1

Add tests to @elisiano's pull request.