Added an option for max edges.

- Needs cleaning up though.