Added overflow limits for encoder