Refactoring, moving string fuktions and grid maipulation funktions into seperate files