Dont check direction in encode method. Performance