Add @option tag

Unit test is included.

Also fixed some bugs.