Separated image stuff. Some code clean up.