Insert imported markup into database, fix bugs