some refactoring and add slice type, mostly to replace array type