update 2

changed ratio function to return optional