Enabled and optimized the offset function