improved expand/contract functionality and optimized node placement