solution for assignment 5, Fast SPoT