refactored working without cross domain