Adding tests from Stack Exchange post