Added another missing test and improved code