hopefully removed bug for old file deletion. Test follows later
removed debug messages, added listener events, added small thing