properly implementing publish