issue #4 and 5

Implements issues #4 and #5.