A cleaner way of handling this problem