changed the equity list separation code to make it work with edge cases