Move extraneous code and the log func