Cleaned up main and added userdata struct construction