Adding code related to coursera assignment 2