added online offline function