Added preliminary code for issues #23 and #19.