all this should be moved to the separate implementation class in .cpp