trip edit and cleaned code