Changed all 512 to BytesPerSector