implementing transformation logic with pseudo code