Cleaned up and thinned by removing some ports and interfaces. events are called directly.