refactored pictures controller