option bug fixed...

-unit tests added
-little code refactoring