enough restruct fixing to remove compiler warnings
add command now properly asserts type to write