fixed calculation issues
fixed incorrect function call
cleaned up code, obs still does not function completely