added file and db cleanup code