Smart layout now considers spacing, should fix #718