based on initial RayWenderlich tutorial