Fix for issue #4, and partial fix for issue #8

For issue #4, I added if statements to check if variables were set.
For issue #8, I fixed the log table records by detecting a soft delete.