added framework for missing values

functional but with inaccurate math. needs serious correction.