added alternative implementations of custom_insert and custom_reverse