significant changes to all the code