added missing methods, refactoring