fixed division error
Minor additions and fixes