removed all printfs, fixed some errors