cleaner way of doing it