Cleaned up the remove & isEmpty methods. Also handle the index out of
bounds exceptions appropriately