added synchronous mode