Using flags from assets. Some refactoring.