Starting refactor; separated html fxns