added normalization

fixed the window size bug also.