hw1 add optimization