Tests and actual implmentation. Also, updated the usage.