Fixed #27
Fixed #24
Improve #27