Separated learning into 2 phases