more untested atlas code, unwritten img function