added a realtime function