Fix variable name for delete command
Clean up to match pep8 style guide
Various bug fixes