Fixed gradient issues and implented RMSProp.