added window resize support
Added more comments