Fixed Apply Function to Accept More Keys and Return Properly

Return now returns an undefined if the input is undefined.
Also allowed for the keys to be more than just ints
Updated my Input Test
Made Some Readability Improvements