removed unused functions, added some tests