Remove unnecessary members and add total length