Corrected issue 5 and issue 4

This fixes #4 and #5