added algoritm and blocks code