changes to reduce round off error, minor edits