big error refactor