Fix output
Fix order
Fix variable names
Remove unused code