comprehensive logic and content modifications to finalize function. working per requirements at this point