added a cleaner way of achieving the same thing