Added functions from Problemset 3