Over hauled the code