Finished second function