Fixed bug with trying to 0 based index and made compile for windows (compiling on linux though :D )