Created structure for functional programming

Created structure for functional programming
Easier to debug this way