Added universal charge and discharge functions