Added full implementation for shuffle method.