convert to minilla
refactor the whole rendering mess and improve error handling