added main and loading ability