simpler implemetation for view functions