Refactored lifecycle scripts, added managed_files.