added some comments, fixed scaling to also screen B, fixed a small memory leak