Fixes for ordering, unused vars, and spelling