second commit with a few bugs worked out