this code is repeated in the method above, is it possible to share it (make a dedicated function or so..)?