Added a function to write to delete its children blocks so that there aren't any left over blocks when writing to the same file. Tried to remove all imaginary numbers and added global variables for them