Finished the reimplementation