Added 'state' as an optional parameter