maybe it's better to split it into two functions and get rid of this warning?