added mem functions, updated header, printstate works