PUD: put state initialisation in it own function