Removal of unused variable in subroutines to shrink and speed up code