Rewrote to use singletons, commented core