why do sedimentary rocks have layers?