Fixed UUID issues and duplicate code