Add check if image has loaded; do minor cleanup