Functions refactoring. Forgot to add files