What could I have done to avoid this better