split into functions, added sample html from HN