Does the job, but I reckon there is a way to make better.