Corrected missing return value and added tests to verify