Removing stray elements