program seems sound, needs corrected math