separate constructor from main.js