added some tests, removed unused lines.