added robust and smooth flags and check for input errors