add generic compile method