Add offline support, fix background mode