Removed unused vars, and clean up