Try to make it to generic function