Partial for #17
Fixed #24