R: clean up src code