save file
reorder code for readability