Modifications on original connection code. Modular schema not working.