make expand/contract from right function properly