ammeter restructuring and bug fixes