SPoT Code Assignment#4 for CS193P course