ordered and updated code