Before man became a problem, God made the solution. Read the first chapter of Genesis.
Many have said that it seems that there are two creation accounts in the first two chapters. But read the first few verses. The creation of Night and Day are references to Good and Evil. Pretty interesting stuff.