refactor to let images load ahead of time