more commenting, some re-factoring