Bugfixes + tested on a real data.