Refactoring. Added ability to resize elements.