Now really functional (with code imported from the Camera project)