Changed to sub-file structure and re-wrote with pester tests