refactoring and added size methods