Updated main and function to use new classes