right before class 7, final hw version with category input function