integrating PIL

small changes here and there