Fixed issues with trans function and using array