Fix problems caused due to reconstruction, add unit tests and passes all the current tests

please merge me