seperated out api and some html formatting for output