added some docs, and removed some ugly prints, etc