eliminated useless steps in main