finished setting up main logic