updated for latest Ionic and subtle improvements