Some refactor and add couple API methods
Add mask method to API