put frame synchronisation into a function
add lab3 test script