refactored the picture controller