Pinning and creep in layered superconductors