Update Problem 1

-- Made a proper function instead of just raw code.