Changed deletion logic in functions.js, minor improvements in testSpec.js