Options fix
Add some phpdoc & code refactor