working implementation
cleanup, added gaussian filter and max iterations