Add implementation for varint with tests