Improved transpose handling

Used constants to define transpose, removed magic numbers from script.