Code modularized and implementations of windows related functions