Latest code for lab2. fixed flashing problem