Added flags and made the program work