moved code into header