separate constructor functions, improve input() and connect()