changed if statement for checking if the structure is empty to use method.