Solve memory issues by using delete[] instead of delete operator.
Let subroutine creation be more readable.