Added auto precision to encode. Needs testing and documentation.