Simplified main.c a bit