encapsulate this hack a bit better