Structure renaming + adding error checking