merge with the code from func