implement slice with tests