Rework slightly to get rid of deprecated things