WinMain refactor and debug

Add range template for int
Refactor