Adapting Trannoy script