added some commenting, minor changes