re-organized, also added a check for no arguments