updated to work with return values