Looks fine to me if it solves the problem the same way. A link might have been good to give here in the comment, so I could have a look.