Refactor code using Struct classes