added resizing
refactoring