Moving functionality out of sdk into readFile
Added check to delete() to prevent deleting invalid (old) pointer