Changes in order to stay similar to cpp version