Restructured flashlight in preparation for unit testing