Working on bugs and adding test code