Fixed #3, #4 and #7.