Integrated Alex's Code