simplified main.js code