Updated Ionic and refactored some functionality