Refactor parallax code