Starting to move functions inside