major bug fixes on category calc step. work in progress on error
estimation