remove unused vars and clean up indentation