Added diff layer logic, which is fairly different o normal layer logic