Moved functions to functions.cs