Adding logic to load pages and transitions