Bug-fix to prior commit 

(delete script tags not greedy)
Add option to use database entries

Change-Id: I15212a5d7b4566d62f87e2048560a2b9857b9c82