fixed some minor bugs affecting performance of main.cpp, modified the iterative remove to reflect the standard convention you can find on wiki/stackoverflow, and added a recursive remove function