Using Array.slice as opposed to a custom function