Add comments
Chnage names of functions and their positions
Add print_ir() for input 'r'