Added real-time offset function and test