removes unused variables
adds function block