First operative and functional version. Tested with fugu datasets