Getting rid of redundant variable declarations in writeToDisk function calls