some adaptions for fast prototyping, validation worked into algorithm
some minor changes, renames