Some formatting and update legacy code