implementation of sync mechanism