Major reconstruction of code