uses logerr instead of print statement.