Refactore a couple of  classes and moved inside foundation module