move interaction code to a separate class