Improved documentation

Converted to yard. Documented return values. Other changes. Closes #45
and #46