Got rid of data loss and made VS compilable