added isEmpty functionality

had to refactor a lot of things along the way