added state change callback stuff