move code into package