cleaned up slice code