reworked to use blessed library; a real mess though