Made all functions terminate synchronously