refactor to generalize, insert_before working, update changelog