Fixed #24

Added tests