Moved some code to infrastructure