1st function working
Working Final Version