Refactoring and added fill_* and clear_* methods