Better way of doing this