Fixed #10, #43, #36, #7.