1) put compile into constructor; 2) add log