commpleted FN004 function