refactored #1395

quick and dirty for first iteration (spike)