screw this, doing it functionally now and mathematically