Shorten the program with some procedures