splitting funcionality in two methods to avoid ambiguity with NULL