Move more code to .cpp