lots of logic error bug fixes. version works