Renamed `as` method to `encode`