Works, but is little hacky