Completed Assignment 1 except for automatic gate closing.