Added a Circuit2D builder and test.
Fixed generic warning and refactored adding listeners.