Refactored and Fixed autoSizing and Borders