refactored methods, added ability to configure additional 'allowed' html elements. Fixed page generation algorithm