Moved Core functions into a partial class for easier readability