solve the problem in a much more elegant and supported way