remove 'return undefined', not working as expected