remove redundant code from -main