Added origin detection