Rearranged code to attempt to work around error message