Fix for layer sorting updates and added grid rotation.