move code to .cpp