Attempting to fix bugs #4 and #2.