applied proposals of #267 by @diegocr