Adding 'extract' function